test: add missing test coverage for stats/incr/nanwmean#9945
test: add missing test coverage for stats/incr/nanwmean#9945KovidhRaj wants to merge 12 commits intostdlib-js:developfrom
Conversation
… namespace This commit adds a package which provides a way to compute the mean of a set of numbers while ignoring NaN values. It is made to address [RFC] Issue stdlib-js#5628, and as suggested in the issue, it is based on a thin wrapper around wmean, similar to the relationship between nansum and sum, mainting API consistency and design. This commit includes appropriate documentation and tests for the new purpose of the package, styles of which are consistent to the stats/incr/* namespace. Fixes: stdlib-js#5628 [RFC] Private-ref: stdlib-js#5628 Authored-by: Don Chacko <donisepic30@gmail.com>
… stats/incr/* namespace This commit adds minor changes to the README.md of the nanwmean package, to improve clarity and fix a mistake in the usage section where a different package was used. Author: Don Roy Chacko <donisepic30@gmail.com> Reviewed-by: hrshya Co-authored-by: Harsh <149176984+hrshya@users.noreply.github.com> Signed-off-by: Don Roy Chacko <52739172+SergeantQuickscoper@users.noreply.github.com>
This commit fixes the lint errors in the nanwmean module. The changes are applied to the following files: - nanwmean/README.md - nanwmean/docs/repl.txt - nanwmean/lib/index.js - nanwmean/lib/main.js - nanwmean/test/test.js Improvements include: - Correcting indentation and spacing issues - Switch to LF line endings
This commit fixes remark lint errors in the README.md file for the `@stdlib/stats/incr/nanwmean` package. Authored By: Don Roy Chacko <donisepic30@gmail.com>
This commit is a license header lint fix for the nanwmean module for the README.md file.
…lib into feature/nanwmean This commit accounts for the merge of the lint_autofix commit to the feature/nanwmean branch.
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
I’ve added missing test coverage for |
Coverage Report
The above coverage report was generated for the changes in this PR. |
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
Planeshifter
left a comment
There was a problem hiding this comment.
Thanks for opening a PR!
|
|
||
| tape( 'the initial accumulated value is `null`', function test( t ) { | ||
| var acc = incrnanwmean(); | ||
| t.equal( acc(), null, 'returns expected value' ); |
There was a problem hiding this comment.
Use t.strictEqual instead of t.equal here (and on lines 107, 118, 126, 136). We use t.strictEqual throughout the project for equality checks.
| t.equal( acc(), null, 'returns expected value' ); | |
| t.strictEqual( acc(), null, 'returns expected value' ); |
| var acc = incrnanwmean(); | ||
|
|
||
| acc( 2.0, 1.0 ); | ||
| t.strictEqual( isnan(acc( 3.0 )), true, 'returns current mean when weight is missing' ); |
There was a problem hiding this comment.
Missing space inside parens. Should be isnan( acc( 3.0 ) ).
| t.strictEqual( isnan(acc( 3.0 )), true, 'returns current mean when weight is missing' ); | |
| t.strictEqual( isnan( acc( 3.0 ) ), true, 'returns current mean when weight is missing' ); |
| acc( NaN, 1.0 ); | ||
| acc( 4.0, 1.0 ); | ||
|
|
||
| t.equal( acc(), 3.0, 'NaN does not posion accumulator state' ); |
There was a problem hiding this comment.
Typo: "posion" → "poison".
| t.equal( acc(), 3.0, 'NaN does not posion accumulator state' ); | |
| t.strictEqual( acc(), 3.0, 'NaN does not poison accumulator state' ); |
| acc( 2.0, 1.0); | ||
| acc( NaN, 1.0); |
There was a problem hiding this comment.
Missing spaces before closing parens on these two lines, and var declarations need to be at the top of the function scope (before acc( 2.0, 1.0 )). Move var v1; and var v2; above the acc(...) calls.
| acc( 2.0, 1.0); | |
| acc( NaN, 1.0); | |
| acc( 2.0, 1.0 ); | |
| acc( NaN, 1.0 ); |
| t.equal( acc(), 2.0, 'ignores invalid inputs and maintains correct mean' ); | ||
| t.end(); | ||
| }); | ||
| tape( 'if not provided a weight, the accumulator function returns NaN', function test( t ) { |
There was a problem hiding this comment.
Need a blank line between tape blocks throughout the file (missing here and before lines 147 and 157). Each tape(...) call should be separated by a blank line from the preceding block's closing });.
| @@ -0,0 +1,41 @@ | |||
| {{alias}}() | |||
There was a problem hiding this comment.
Missing leading blank line. repl.txt files should start with an empty line before {{alias}}. Also, the parameter block (lines 12-15) doesn't follow the standard format. Compare against incrwmean's repl.txt for the expected structure.
|
okay will do the required changes and fix it. |
Resolves #{{TODO: add issue number}}.
Description
This PR adds missing unit test coverage for
@stdlib/stats/incr/nanwmean,mirroring the behavioral guarantees of
wmeanwith appropriate adaptationsfor NaN-skipping behavior.
No changes to implementation logic are included.
Related to #6441.
This pull request:
adds missing unit test coverage for
@stdlib/stats/incr/nanwmean,mirroring the behavioral guarantees of
wmeanwith appropriate adaptations forNaN-skipping behavior. No changes to implementation logic are included.
This work helps complete the existing
nanwmeanimplementation proposed in #6441.Related Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers